﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Threading.Tasks;

namespace ART.Windows.HelpDesk.TicketServerService
{
    public partial class HelpDeskService : ServiceBase
    {
        private TicketServerCore.TicketCore m_objTicketCore;

        public HelpDeskService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            try
            {
                m_objTicketCore = new TicketServerCore.TicketCore();
                m_objTicketCore.Start();
                EventLog.WriteEntry("Help desk service started sucessfully");
            }
            catch(Exception ex)
            {
                EventLog.WriteEntry("Error Start Help desk service: " + ex.Message);
            }
        }

        protected override void OnStop()
        {
            try 
            { 
                m_objTicketCore.Stop();
                EventLog.WriteEntry("Help desk service stopped sucessfully");
            }
            catch(Exception ex)
            {
                EventLog.WriteEntry("Error Stop Help desk service: " + ex.Message);
            }
        }


    }
}
